package com.ai.manager.edu.cms.info.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ai.dao.edu.cms.info.InfoDetailMapper;
import com.ai.manager.edu.cms.info.InfoDetailManager;
import com.ai.model.edu.cms.info.InfoDetail;
import com.ai.model.edu.cms.info.dto.InfoDetailDTO;
import com.ai.model.edu.cms.info.vo.InfoDetailVO;

@Component("infoDetailManager")
public class InfoDetailManagerImpl implements InfoDetailManager {
	@Resource
	private InfoDetailMapper infoDetailMapper;
	
	/**
     * 保存资讯记录
     */
    public Long insertInfoDetail(InfoDetail record) {
    	return infoDetailMapper.insertInfoDetail(record);
    }
    
    
	@Override
    public Long deleteInfoDetail(Long id, Long operator) {
        return infoDetailMapper.deleteInfoDetail(id,operator);
    }

    /**
     * 更新资讯记录
     */
    public Long updateInfoDetail(InfoDetail record) {
    	return infoDetailMapper.updateInfoDetail(record);
    }
	
    /**
     * 根据条件查询资讯记录
     */
    public List<InfoDetailVO> findInfoDetailByDto(InfoDetailDTO dto) {
    	return infoDetailMapper.findInfoDetailByDto(dto);
    }
    
    
    @Override
    public List<InfoDetailVO> findInfoDetailPageByDto(InfoDetailDTO dto) {
        return infoDetailMapper.findInfoDetailPageByDto(dto);
    }

    @Override
    public Long countFindInfoDetailPageByDto(InfoDetailDTO dto) {
        return infoDetailMapper.countFindInfoDetailPageByDto(dto);
    }

    /**
     * 计算满足条件查询资讯记录数
     */
    public Long countInfoDetailByDto(InfoDetailDTO dto) {
    	return infoDetailMapper.countInfoDetailByDto(dto);
    }

    /**
     * 根据主键删除记录
     */
    public Long deleteInfoDetailById(Long id) {
    	return infoDetailMapper.deleteInfoDetailById(id);
    }

    /**
     * 根据主键查询记录
     */
    public InfoDetailVO selectInfoDetailById(Long id) {
    	return infoDetailMapper.selectInfoDetailById(id);
    }

	/* 
	 * 批量修改审核状态
	 */
	@Override
	public void betchUpdateInfoDetailByIds(InfoDetailDTO dto,List<Long> ids) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("dto", dto);
		map.put("idList", ids);
		infoDetailMapper.betchUpdateInfoDetailByIds(map);
	}

	/* 
	 * 批量查询资讯信息
	 * daizy
	 */
	@Override
	public List<InfoDetailVO> betchFindInfoDetailByIds(List<Long> ids) {
		return infoDetailMapper.selectInfoDetailByIds(ids);
	}


	@Override
	public InfoDetailVO findInfoDetailById(Long id) {
		return infoDetailMapper.findInfoDetailById(id);
	}
}